<!DOCTYPE HTML>
<html  lang="zh" xmlns:th="http://www.thymeleaf.org">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-goodsInfo-add">
			<div class="form-group">	
				<label class="col-sm-2 control-label">餐饮名称：</label>
				<div class="col-sm-9">
					<input id="goodsName" name="goodsName" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-2 control-label">简介说明：</label>
				<div class="col-sm-9">
					<textarea id="briefInformation" name="briefInformation" class="form-control"></textarea>
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-2 control-label">类型：</label>
				<div class="col-sm-9">
					<select id="goodsType" name="goodsType" class="form-control" th:with="type=${@dict.getType('goods_type_item')}">
						<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
					</select>
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-2 control-label">首图：</label>
				<div class="col-sm-9">
					<input id="file" name="file" class="form-control" accept="image/*" type="file">
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-2 control-label">原料：</label>
				<div class="col-sm-9">
					<input id="attr1" name="attr1" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-2 control-label">价格：</label>
				<div class="col-sm-3">
					<input id="goodsPrice" name="goodsPrice" class="form-control" type="text">
				</div>
				<label class="col-sm-3 control-label">库存：</label>
				<div class="col-sm-3">
					<input id="goodsLeft" name="goodsLeft" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-2 control-label">展示详情：</label>
				<div class="col-sm-9">
					<div class="summernote" sn-data-id="details"></div>
					<input id="details" name="details"  type="hidden">
				</div>
			</div>
		</form>
	</div>
    <div th:include="include::footer"></div>
    <script th:inline="javascript">
		var prefix = ctx + "system/goodsInfo"
		$("#form-goodsInfo-add").validate({
			rules:{
                goodsName:{
					required:true,
				},
                file:{
                    required:true,
                },
                goodsPrice:{
                    required:true,
					number:true
                },
                goodsLeft:{
                    required:true,
					number:true
                },

			}
		});
		

        $.form.init({
            url:prefix + "/add",
            beforeSubmit:function () {
                return $.validate.form();
            },
            success:function (result) {
                $.operate.successCallback(result);
            }
        });
        function submitHandler() {
            $('#form-goodsInfo-add').submit();
        }

	</script>
</body>
</html>
